#ifndef QGUI_H_
#define QGUI_H_

#include "QCore.h"
#include "QStyle.h"

class QWidget;
typedef struct _canvas_t canvas_t;

//QPen
class QPen 
{
public:
    QPen();
    QPen(Qt::GlobalColor c);

    QColor color() const;

protected:
    QColor m_color;
};

//QBrush
class QBrush
{
public:
    QBrush();
    QBrush(Qt::GlobalColor c);

    QColor color() const;

protected:
    QColor m_color;
};

//QImage
class QImage
{
public:
    QImage();
    QImage(QString url);
    QString id() const;
    
    bool load(QString path);

    QSize size() const;
    int width() const;
    int height() const;

protected:
    QString m_id;
    int m_width;
    int m_height;
};

//class
class QIcon
{
public:
    QIcon();
    QIcon(QString res);

    QString id() const;

protected:
    QString m_id;
};

//QFont
class QFont
{
public:
    QFont();

    QString family() const;
    void setFamily(QString family);

    int pixelSize() const;
    void setPixelSize(int size);

protected:
    QString m_family;
    int m_size;
};

//QPainter
class QPainter
{
public:    
    QPainter(QWidget *widget);
    ~QPainter();

    QFont font();

    void setWindow(QRect rc);
    QRect window();

    void save();
    void restore();

    void setPen(QPen pen);
    void setBrush(QBrush pen);
    void setFont(QFont ft);

    void rotate(double angle);
    void translate(int x,int y);
    void translate(QPoint pt);

    void drawRect(QRect rc);

    void drawText(int x,int y, QString text);
    void drawText(QRect rc, int option, QString text);
    void drawImage(int x,int y, const QImage &image);
    void drawImage(QPoint pt, const QImage &image);    

protected:
    struct CanvasInfo{
        int x;
        int y;
    };

    canvas_t *canvas();
    QPen m_pen;
    QBrush m_brush;
    double m_rotate;

    QWidget *m_widget;
    vector<CanvasInfo> m_canvasList;    
};

#endif // !QPAINTER_H_
